<?php
/**
 * <b>RUBIK IT Solution & Development ltd.</b>
 *
 * PROJECT		: Rubik Ultimate Framework
 * @version 	: 1.1
 * COPYRIGHT    : 2008
 * ------------------------------------------------------
 * 
 * [GENERAL INFO OF THIS FILE] 
 *
 * @author			Administrator <Administrator@rubik.com.vn>
 * @access			[public/private]
 * @package			[package name]
 *
 * Created on	: Nov 17, 2008
 */
defined ( '_FW_EXEC' ) or die ( 'Restricted access' );

function checkOverLimitation($type, $id) {
	if (SysAuthenticate::isLogged()) {
		return false;
	}
	
	static $dto;
	if (empty($dto)) {
		RClassesImporter::cls('dbo.dtos.ConfigurationDTO');
		$dto = new ConfigurationDTO();
		$dto->setKeyValue(1);
		SysDatabase::fillData($dto);
	}

	$key = "guess_{$type}";
	$limit = $dto->$key;
	if (count($_SESSION["__LIMIT_{$key}"]) >= $limit) {
		return $dto->over_allow_url;
	}
	
	$_SESSION["__LIMIT_{$key}"][$id] = true;
	return false;
}
?>